package model

import (
	"time"

	"gorm.io/gorm"
)

type User struct {
	ID          uint           `gorm:"primarykey" json:"id"`
	Phone       string         `gorm:"uniqueIndex;size:11" json:"phone"`
	Password    string         `gorm:"size:255" json:"-"`
	Nickname    string         `gorm:"size:50" json:"nickname"`
	Avatar      string         `gorm:"size:255" json:"avatar"`
	Status      int            `gorm:"default:1;comment:'状态: 1-正常 0-禁用'" json:"status"`
	PasswordSet bool           `gorm:"default:false;comment:'是否已设置密码'" json:"password_set"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	DeletedAt   gorm.DeletedAt `gorm:"index" json:"-"`
}

func (User) TableName() string {
	return "users"
}
